package com.example.polarity;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.view.View;

public class Planets extends View {
	
	public Bitmap planetImage; 
	
	public int posX;
	public int posY;
	
	public int width;
	public int height;
	
	public int pivotX; 
	public int pivotY;
	
	public int duration = 6000;
	
	public float rotation = 1;
	public float rotationInc = 1;
	public int bitmapId;
	public Bitmap resizedPlanet; 
	
	public float imagePercentage;
	
	public Planets(Context context, int index)
	{
		super(context);
		
		this.duration = this.duration * index;
		bitmapId = GetBitmap(index);
		planetImage = BitmapFactory.decodeResource(getResources(), bitmapId);
		rotationInc = (float) ((16/index) * 0.1);
		resizedPlanet = planetImage;
		setImagePercentage(index);
	}
	
	public int GetBitmap(int index)
	{
		switch(index)
		{
			case 1:
				return R.drawable.planet1;
			case 2:
				return R.drawable.planet2;
			case 3:
				return R.drawable.planet3;
			case 4:
				return R.drawable.planet4;
			case 5:
				return R.drawable.planet8;
			case 6:
				return R.drawable.planet7;
			/*case 7:
				return R.drawable.planet8;*/
			default:
				return R.drawable.sunbg;
		}
	}

	public void setImagePercentage(int index)
	{
		switch(index)
		{
			case 1:
				imagePercentage = (float) 0.03;
				break;
			case 2:
				imagePercentage = (float) 0.05;
				break;
			case 3:
				imagePercentage = (float) 0.06;
				break;
			case 4:
				imagePercentage = (float) 0.07;
				break;
			case 5:
				imagePercentage = (float) 0.05;
				break;
			case 6:
				imagePercentage = (float) 0.03;
				break;
			/*case 7:
				imagePercentage = (float) 0.05;
				break;*/
			default:
				imagePercentage = (float) 0.10;
				break;
		}
	}
}
